package demo;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author or2
 * @Description
 * @create 2021年08月12日 时间: 16:46
 */
public class GetString {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();

        char[] chars = str.toCharArray();

        int offset = scanner.nextInt();
        decode(chars, offset);
//        System.out.println(getString(str, offset));
    }

    private static void decode(char[] chars, int offset) {
        int key = 252082248 + offset;

        int num3;
        int num2 = 0;

        while (true) {
            int num5;
            int num4 = num5 = num2;
            int num6 = num5;
            char c = chars[num5];
            byte b = (byte) ((c & 'ÿ') ^ key++);
            byte b2 = (byte) ((c >> 8) ^ key++);
            byte b3 = b2;
            b2 = b;
            b = b3;
            chars[num6] = (char) ((int) b2 << 8 | (int) b);
            num3 = num4 + 1;
            if ((num2 = num3) >= chars.length) {
                String ans = new String(chars);
                System.out.println(ans);
                break;
            }
        }
    }

    static String getString(String source, int salt) {
        int index = 0;
        char[] data = source.toCharArray();
        salt += 252082248; // This const data generated by dotfuscator
        while (index < data.length) {
            char key = data[index];
            byte low = (byte) ((key & 255) ^ salt++);
            byte high = (byte) ((key >> 8) ^ salt++);
            data[index] = (char) ((low << 8 | high));
            index++;
        }
        return new String(data);
    }
}
